*** Settings ***
Library    Collections
Library    SerialLibrary
Library    String

*** Variables ***
${POWER_ON}       A0 01 01 A2
${POWER_OFF}      A0 01 00 A1

${SLEEP_TIME_ON}        ${3}
${SLEEP_TIME_OFF}       ${1}

*** Keywords ***
########################  SERIAL  #########################
Device Setup Power
    [Documentation]        Power Contrl Port Setup
    [Arguments]            ${power}
    Add Port               ${power}    baudrate=9600      timeout=1    write_timeout=0.1    inter_byte_timeout=0.1
    Set Global Variable    ${power}
    SerialLibrary.Set Encoding    utf-8

Device Power On
    [Documentation]        Power ON
    Write Data             ${POWER_ON}           encoding=hexlify     port_locator=${power}
    sleep                  ${SLEEP_TIME_ON}


Device Power Off
    [Documentation]        Power OFF
    Write Data             ${POWER_OFF}          encoding=hexlify     port_locator=${power}
    sleep                  ${SLEEP_TIME_OFF}

Device Power Reset
    [Documentation]        Power Reset
    Device Power Off
    Device Power On

###########################################################

########################  DEINIT  #########################

Device DeInit
    Log To Console    ============== robot test finish =====================
    Device Power Off
